package cn.parus.commons.common.Log.utils;

import org.springframework.web.server.ServerWebExchange;
import reactor.util.context.Context;

/**
 * @Title: ServerWebExchangeContext
 * @Author 潘春兰
 * @Package cn.parus.commons.common.Log.utils
 * @Date 2025/4/1 23:17
 * @description: TODO 服务器请求上下文工具类
 * @Version:
 */
public class ServerWebExchangeContext {
    public static final String SERVER_WEB_EXCHANGE_CONTEXT_KEY = "serverWebExchange";

    public static ServerWebExchange getServerWebExchange() {
        return ContextViewHack.getContext()
                .getOrDefault(SERVER_WEB_EXCHANGE_CONTEXT_KEY, null);
    }

    // 辅助类用于访问 Reactor Context
    private static class ContextViewHack {
        static Context getContext() {
            return Context.empty(); // 实际实现需要从订阅链获取
        }
    }

}
